function AfterSthByButton(json){
    var that = this;

    this.isInit = true;
    this.isOpen = false;

    this.controlEl = $(json.controlEl);
    this.temp = json.temp;
    this.callbackOnce = json.callbackOnce || null;

    this.controlEl.on("click",function(){
        if(that.isOpen){  //开启状态
            that.hide();
        }else{             //关闭状态
            if(that.isInit){
                that.init();
                that.isInit = false;
                that.callbackOnce && that.callbackOnce.call(this);
            }else{
                that.show();
            }
        }
        that.isOpen = !that.isOpen;
    });

    this.show = function(){
        this.controlEl.parents(".list-content").next().slideDown(160);
    };
    this.init = function(){
        var $parent = this.controlEl.parents(".list-content");
        $parent.after(that.temp);
    };
    this.hide = function(){
        this.controlEl.parents(".list-content").next().slideUp(160);
    };
}

function createMessage(json){
    var name = json.name;
    var time = json.time;
    var content = json.content;
    var html = '<ul> <li> <div class="list-content"> '
        +'<div class="clearfix"> <h3 class="fl"><span class="sc-list-name">'+name+'</span><small>&nbsp;<span class="color-pink">|</span> '+time+'</small> </h3><button type="button" class="btn btn-clean fr btn-commenting" title="Leave a message"><i class="fa fa-commenting-o" aria-hidden="true"></i></button></div>'
        +'<p class="sc-list-content">'+content+'</p> </div> </li> </ul>';
    return html;
}